<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="Beans.ClientRoomOrder" %>
<%@ page import="Beans.QueryRoomInfo" %>
<%@ page import="Beans.QueryDateInfo"%>
<html>
	<%
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	%>
  <head>
	 <meta charset="UTF-8">
    <title>查询信息</title>
    <link href=<%=basePath+"/stylesheets/queryInfo.css"%> type="text/css" rel="stylesheet">
    <style>
        html,body{
            margin:0;
            padding: 0;
        }
    </style>
  </head>
  
  <body>
  	<%
  		String msg = (String)session.getAttribute("msg");
  		session.removeAttribute("msg");
  		if(msg!=null&&msg!=""){
  			%>
  			<script type="text/javascript">
  				var msg = '<%=msg%>';
  				alert(msg);
  			</script>
  			<%
  		}
  	 %>
<div id="themeText">查询信息</div>
<div id="showRoomFrame">
    <div style="min-height: 300px;border-bottom: 1px solid #dcdcdc;">
    	<div class="inputDiv">
        <form action="/HotelSystem/Servlets/QueryInfoServlet" method="post">
            <span>客户姓名：</span>
            <input type="text" class="inputInfo" style="padding-right: 0;width: 200px;" name="name">
            <input type="submit" value="查询" class="inputBtn">
        </form>
    	</div>
	    <table cellpadding="0" cellspacing="0" style="margin-top: 30px">
	        <thead>
	        <tr>
	            <th>顾客姓名</th>
	            <th>身份证</th>
	            <th>电话</th>
	            <th>年龄</th>
	            <th>房号</th>
	            <th>性别</th>
	            <th>入住日期</th>
	            <th>是否退房</th>
	        </tr>
	        </thead>
	        <tbody id="mainbody">
	        <%
	        	ArrayList<ClientRoomOrder> clientList = null;
	        	clientList = (ArrayList<ClientRoomOrder>)session.getAttribute("clientList");
	        	session.removeAttribute("clientList");
	        	String date = "";
	        	int outstatus=0;
	        	if(clientList!=null){
	        		for(int i = 0;i<clientList.size();i++){
	        			outstatus = clientList.get(i).getOutStatus();
	        			%>
	        			<tr id="delCell">
				            <td width="13%"><%=clientList.get(i).getName() %></td>
				            <td width="13%"><%=clientList.get(i).getIdCard() %></td>
				            <td width="13%"><%=clientList.get(i).getPhone() %></td>
				            <td width="13%"><%=clientList.get(i).getAge() %></td>
				            <td width="13%"><%=clientList.get(i).getRoomId() %></td>
				            <td width="13%"><%=clientList.get(i).getSex() %></td>
				            <td width="13%"><%=clientList.get(i).getIndate() %></td>
				            <%
				            	if(outstatus==0){
				            		%>
				            		<td width="13%" style="color: red;">未退房</td>
				            		<%
				            	}else{
				            		%>
				            		<td width="13%" style="color: red;">已退房</td>
				            		<%
				            	}
				             %>
	        			</tr>
	        			<%
	        		}
	        	}
	         %>
	        </tbody>
	    </table>
    </div>
    <div style="min-height: 300px;border-bottom: 1px solid #dcdcdc;">
        <div class="inputDiv">
            <form action="/HotelSystem/Servlets/QueryRoomServlet">
                <span>房号：</span>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 200px;" name="roomid">
                <input type="submit" value="查询" class="inputBtn">
            </form>
        </div>
        <table cellpadding="0" cellspacing="0" style="margin-top: 30px">
            <thead>
            <tr>
                <th>房号</th>
                <th>房间类型</th>
                <th>房间租金</th>
                <th>房间定金</th>
                <th>房间状态</th>
            </tr>
            </thead>
            <tbody>
            <%
            	ArrayList<QueryRoomInfo> roomList = new ArrayList<QueryRoomInfo>();
            	roomList = (ArrayList<QueryRoomInfo>)session.getAttribute("roomList");
            	session.removeAttribute("queryRoom");
            	if(roomList != null){
            		for(int i = 0;i<roomList.size();i++){
            		%>
            			<tr>
			                <td width="20%"><%=roomList.get(i).getRoomid()%></td>
			                <td width="20%"><%=roomList.get(i).getRoomname() %></td>
			                <td width="20%"><%=roomList.get(i).getRent() %></td>
			                <td width="20%"><%=roomList.get(i).getEarnest()%></td>
			                <%
			                	if(roomList.get(i).getStatus().equals("0")){
			                		%>
			                		<td width="20%" style="color:red">正在使用</td>
			                		<%
			                	}else{
			                		%>
			                		<td width="20%" style="color:red">空</td>
			                		<%
			                	}
			                 %>
            			</tr>
            			<%
            		}
            	}
             %>
        </table>
    </div>
    
    <div style="min-height: 300px;border-bottom: 1px solid #dcdcdc;">
        <div class="inputDiv">
            <form action="/HotelSystem/Servlets/IndateServlet" method="post">
                <span>入住日期：</span>
                <input type="date" class="inputInfo" style="padding-right: 0;width: 200px;" name="indate">
                <input type="submit" value="查询" class="inputBtn">
            </form>
        </div>
        <table cellpadding="0" cellspacing="0" style="margin-top: 30px">
            <thead>
            <tr>
                <th>姓名</th>
                <th>身份证</th>
                <th>房号</th>
                <th>入住日期</th>
                <th>离开日期</th>
            </tr>
            </thead>
            <tbody>
            <%
            	ArrayList<QueryDateInfo> inList = null;
            	inList  = (ArrayList<QueryDateInfo>)session.getAttribute("inDateList");
            	session.removeAttribute("inDateList");
            	if(inList!=null){
            		for(int i = 0;i<inList.size();i++){
            			System.out.println(inList.get(i).getName());
            			%>
            			<tr>
			                <td width="20%"><%=inList.get(i).getName() %></td>
			                <td width="20%"><%=inList.get(i).getIdCard() %></td>
			                <td width="20%"><%=inList.get(i).getRoomid() %></td>
			                <td width="20%"><%=inList.get(i).getIndate() %></td>
			                <%
			                	if(inList.get(i).getOutdate()==null){
			                		%>
			                		<td width="20%">未离开</td>
			                		<%
			                	}else{
			                		%>
			                		<td width="20%"><%=inList.get(i).getOutdate() %></td>
			                		<%
			                	}
			                 %>
            			</tr>
            			<%
            		}
            	}
             %>
            </tbody>
        </table>
    </div>
    
    <div style="min-height: 300px;border-bottom: 1px solid #dcdcdc;margin-bottom:20px">
        <div class="inputDiv">
            <form action="/HotelSystem/Servlets/OutdateServlet">
                <span>离开日期：</span>
                <input type="date" class="inputInfo" style="padding-right: 0;width: 200px;" name="outdate">
                <input type="submit" value="查询" class="inputBtn">
            </form>
        </div>
        <table cellpadding="0" cellspacing="0" style="margin-top: 30px">
            <thead>
            <tr>
                <th>姓名</th>
                <th>身份证</th>
                <th>房号</th>
                <th>入住日期</th>
                <th>离开日期</th>
            </tr>
            </thead>
            <tbody>
            <%
            	ArrayList<QueryDateInfo> outList = null;
            	outList  = (ArrayList<QueryDateInfo>)session.getAttribute("outDateList");
            	session.removeAttribute("outDateList");
            	if(outList!=null){
            		for(int i = 0;i<outList.size();i++){
            			%>
            			<tr>
			                <td width="20%"><%=outList.get(i).getName() %></td>
			                <td width="20%"><%=outList.get(i).getIdCard() %></td>
			                <td width="20%"><%=outList.get(i).getRoomid() %></td>
			                <td width="20%"><%=outList.get(i).getIndate() %></td>
			                <td width="20%"><%=outList.get(i).getOutdate() %></td>
            			</tr>
            			<%
            		}
            	}
             %>
            </tbody>
        </table>
    </div>
    
</div>

  </body>
</html>
